from django import forms
from django.forms import ModelForm
from gmoney.members import models
from django.forms.extras.widgets import SelectDateWidget

class MemberForm(ModelForm):
    class Meta:
        model = models.Member
        fields = ('nickname', )
    
class ChargingForm(ModelForm):
    class Meta:
        model = models.Charging
        fields = ('money', )
        
class ActivityForm(ModelForm):
    members = forms.ModelMultipleChoiceField(widget=forms.CheckboxSelectMultiple(),queryset=None)
    
    def __init__(self, queryset=None, *args, **kwargs):
        super(ActivityForm, self).__init__(*args, **kwargs)
        self.fields['members'].queryset = queryset
        
    
    class Meta:
        model = models.Activity
        exclude = ('team', )
        
        
class TestForm(forms.Form):
    DISTRICT_IN_BEIJING = (
        ('HD', 'Hai Dian'),
        ('CY', 'Chao Yan'),
        ('DC', 'Dong Cheng'),
        ('XC', 'Xi Cheng'),
    )
    choice = forms.MultipleChoiceField(choices = DISTRICT_IN_BEIJING,widget=forms.CheckboxSelectMultiple)
    
    default_choice = forms.ChoiceField(choices = DISTRICT_IN_BEIJING)
    default_multiple_choice = forms.MultipleChoiceField(choices = DISTRICT_IN_BEIJING)
    
    radio_choice = forms.ChoiceField(choices = DISTRICT_IN_BEIJING, widget=forms.RadioSelect)
    radio_multiple_choice = forms.MultipleChoiceField(choices = DISTRICT_IN_BEIJING, widget=forms.RadioSelect)
    
    checkbox_group_choice = forms.ChoiceField(choices = DISTRICT_IN_BEIJING, widget=forms.CheckboxSelectMultiple)
    SelectMultiple_choice = forms.ChoiceField(choices = DISTRICT_IN_BEIJING, widget=forms.SelectMultiple)
    
    d = forms.TypedChoiceField()
    date_field = forms.DateField(widget=SelectDateWidget)
    datetime_field = forms.DateTimeField(widget=forms.SplitDateTimeWidget)
    email_field = forms.EmailField()
    url_field = forms.URLField()
    combo_field = forms.ComboField()
    
    i = forms.SplitDateTimeField()
    